package com.yufei.toolinterface.listener;

import javax.swing.JFrame;

import com.yufei.infoExtractor.listener.InfoExtractorCommonTaskListener;
import com.yufei.infoExtractor.listener.InfoExtractorEvent;
import com.yufei.infoExtractor.task.InfoExtractorCommonTask;
import com.yufei.toolinterface.TaskMPanel;

public class SwingInfoExtractorCommonTaskListener implements
		InfoExtractorCommonTaskListener {
	private JFrame jframe=null;


	public SwingInfoExtractorCommonTaskListener(JFrame jframe) {
		super();
		this.jframe=jframe;
		// TODO Auto-generated constructor stub
	}

	@Override
	public void urlFetchedNumberChanged(InfoExtractorEvent e) {
		// TODO Auto-generated method stub
          TaskMPanel taskMPanel=(TaskMPanel) jframe;
          InfoExtractorCommonTask infoExtractorCommonTask=(InfoExtractorCommonTask) e.getSource();
          Integer urlFetchedNumber=infoExtractorCommonTask.getInfoExtractTaskStatistics().getUrlFetchedNumber();
          //更行界面上对应的值
          taskMPanel.updateTaskStatusListTable(infoExtractorCommonTask.getTask().getTaskName(), 2, urlFetchedNumber);
          
	}

	@Override
	public void urlExtractedNumberChanged(InfoExtractorEvent e) {
		// TODO Auto-generated method stub
	    TaskMPanel taskMPanel=(TaskMPanel) jframe;
        InfoExtractorCommonTask infoExtractorCommonTask=(InfoExtractorCommonTask) e.getSource();
        Integer urlExtractedNumber=infoExtractorCommonTask.getInfoExtractTaskStatistics().getUrlExtractedNumber();
        //更行界面上对应的值
        taskMPanel.updateTaskStatusListTable(infoExtractorCommonTask.getTask().getTaskName(), 3, urlExtractedNumber);
        
	}

}
